package com.carrara.helloworld;

import java.util.Scanner;

public class Calculator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		boolean repeat;
		
		while (repeat = true)
		{
		// Input for numbers and operation.
		System.out.println("What is your first number?");
		
		Scanner num1 = new Scanner(System.in);
		int number1 = num1.nextInt();
		
		System.out.println("What is your second number?");
		
		Scanner num2 = new Scanner(System.in);
		int number2 = num2.nextInt();
		
		System.out.println("What operation do you want to do?");
		
		Scanner op = new Scanner(System.in);
		String operation = op.next();
		// Choices of operation in =/-/*//.
		if (operation.equals("+"))
		{
			System.out.println(number1+number2);
		}
		else if (operation.equals("-"))
		{
			System.out.println(number1-number2);
		}
		else if (operation.equals("*"))
		{
			System.out.println(number1*number2);
		}
		else if (operation.equals("/"))
		{
			System.out.println(number1/number2);
		}
		// Choices of operation in full words.
		else if (operation.equals("addition"))
		{
			System.out.println(number1+number2);
		}
		else if (operation.equals("subtraction"))
		{
			System.out.println(number1-number2);
		}
		else if (operation.equals("multiplication"))
		{
			System.out.println(number1*number2);
		}
		else if (operation.equals("division"))
		{
			System.out.println(number1/number2);
		}
		// Other/invalid choices of operation.
		else
		{
			System.out.println("Invalid operation.");
		}
				
		System.out.println("Would you like to calculate again?");
		
		Scanner repeater = new Scanner(System.in);
		String rep = repeater.next();
		
		if (rep.equals("yes"))
		{
			repeat = true;
		}
		else
		{
			repeat = false;
		}
		}
	}
}
